import React, { Component } from 'react'

export default class RefDemo extends Component {
  inputRef = React.createRef()
  render() {
    return (
      <div>
        <input ref={this.inputRef}></input>
        {/* <input ref="myref"></input> */}
        <button onClick={this.handleClick}>点击</button>
      </div>
    )
  }
  handleClick = () => {
    // console.log(this.inputRef.current.value)
    console.log(this.inputRef.current.value)
  }
}
